#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 2e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n;
void solve()
{
    cin >> n;
    string s;
    cin >> s;
    s+='?';

    for(int i = 0; i < n; i++)
    {
        s[i] = tolower(s[i]);
    }

    string s2;
    for(int i = 0; i < n; i++)
    {
        if(s[i] != s[i + 1]) s2.push_back(s[i]);
    }

    string ans = "meow";

    if(s2.size() > ans.size() || s2.size() < ans.size()||s2!=ans)
    {
        cout << "NO" << '\n';
        return;
    }

    cout<<"YES"<<'\n';





}

int main()
{
    close();
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}